package com.yhl.aiDemo.wisdom_doctor.controller;

import com.yhl.aiDemo.wisdom_doctor.agent.DoctorAgent;
import com.yhl.aiDemo.wisdom_doctor.bean.ChatForm;
import dev.langchain4j.community.model.dashscope.QwenStreamingChatModel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@Tag(name = "智慧小医")
@RestController
@RequestMapping("/dockerAgent")
public class DockerAgentController {

    @Autowired
    private DoctorAgent doctorAgent;

    @Operation(summary = "对话")
    @PostMapping(value = "/chat", produces = "text/stream;charset=UTF-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return doctorAgent.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }

}

